<template>
	<view class='InviteNewPeople'>
		<navBar><template #title>邀请好友</template></navBar>
		<view class='secureCase'>
			<text>
				Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida
				dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar sic tempor. Sociis
				natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus
				pharetra vulputate, felis tellus mollis orci, sed rhoncus pronin sapien nunc accuan eget.Lorem ipsum
				dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet.
			</text>
			<text>我的邀请码：{{Invite}}</text>
			<van-button @click="upWx(Invite)">复制并打开微信</van-button>
		</view>
	</view>
</template>

<script lang='ts' setup>
	import {
		ref
	} from 'vue'
	import navBar from '../../components/mine/navBar/index.vue'

	const Invite = ref('20DJK309DKFG')

	const upWx = (Invite: string) => {
		try {
			uni.share({
				provider: "weixin",
				scene: "WXSceneSession",
				type: 0,
				href: 'https://m.baidu.com',
				title: 'hbuilderx',
				summary: '邀请码：' + Invite,
				imageUrl: '/static/logo.png',
				showArrow: false, // 隐藏箭头图标
				success: function(res) {
					console.log(JSON.stringify(res));
					uni.showToast({
						title: '已分享',
						duration: 2000
					});
				},
				fail: function(err) {
					var errrr = JSON.stringify(err);
					if (errrr) {
						uni.showModal({
							title: '表单不能留空',
							content: '请完善所有信息再发起分享',
							success: function(res) {
								if (res.confirm) {
									console.log('用户点击确定');
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						});
					}
				}
			});
		} catch (e) {
			alert('PC/h5端不能邀请')
		}

	}
</script>

<style lang='scss' scoped>
</style>